import Vue from "vue";
import VueRouter from "vue-router";
//懒加载导入
const Home = () => import('../views/home/Home')
const Cart = () => import('../views/cart/Cart')
const Profile = () => import('../views/profile/Profile')
const Category = () => import('../views/category/Category')
//安装插件
Vue.use(VueRouter)

//创建路由对象
//数组名字！！！routes！！！
const routes = [
  {
    path:'',
    //重定向
    redirect:'/home'
  },
  {
    path: '/home',
    component: Home
  },

  ,
  {
    path: '/profile',
    component: Profile
  }
  ,
  {
    path: '/cart',
    component: Cart
  }
  ,
  {
    path: '/category',
    component: Category
  }


]

const router = new VueRouter({
  routes,
  mode: 'history'
})





//导出router
export default router
